home *** CD-ROM | disk | FTP | other *** search
/ Megarom / Megarom Macintosh CD Software (Quantum Leap)(1992).iso / COMPRESS / Utilities / Zmodem.text < prev   
Encoding:
Text File  |  1991-12-29  |  60.4 KB  |  3,173 lines  |  [TEXT/EDIT]

  1. 1 This document is meant to printed on a 66 line/page printer.
  2.  
  3. 2 I’ve included the first page so that you’ll be able to test print it
  4.  
  5. 3 out to make sure the rest of the document comes out currectly. You can
  6.  
  7. 4 then cut the first page out where indicated below. If you’re uploading or
  8.  
  9. 5 spreading this document around, please include this first page. I’ve gone
  10.  
  11. 6 through unbelivable pains in order to make this thing print out right.
  12.  
  13. 7 For those Mac owners who’ve gotten this file instead of the MacWriteII file,
  14.  
  15. 8 use the follwing info to make your task alot simpler.
  16.  
  17. 9 page setup => options / larger print area
  18.  
  19. 10 font = Courier 10
  20.  
  21. 11 line spacing = 0.158” (Format/Paragraph menuitem)
  22.  
  23. 12 top margin = bottom margin = 0.25” (Format/Page menuitem)
  24.  
  25. 13
  26.  
  27. 14
  28.  
  29. 15
  30.  
  31. 16
  32.  
  33. 17
  34.  
  35. 18
  36.  
  37. 19
  38.  
  39. 20
  40.  
  41. 21
  42.  
  43. 22
  44.  
  45. 23
  46.  
  47. 24
  48.  
  49. 25
  50.  
  51. 26
  52.  
  53. 27
  54.  
  55. 28
  56.  
  57. 29
  58.  
  59. 30
  60.  
  61. 31
  62.  
  63. 32
  64.  
  65. 33
  66.  
  67. 34
  68.  
  69. 35
  70.  
  71. 36
  72.  
  73. 37
  74.  
  75. 38
  76.  
  77. 39
  78.  
  79. 40
  80.  
  81. 41
  82.  
  83. 42
  84.  
  85. 43
  86.  
  87. 44
  88.  
  89. 45
  90.  
  91. 46
  92.  
  93. 47
  94.  
  95. 48
  96.  
  97. 49
  98.  
  99. 50
  100.  
  101. 51
  102.  
  103. 52
  104.  
  105. 53
  106.  
  107. 54
  108.  
  109. 55
  110.  
  111. 56
  112.  
  113. 57
  114.  
  115. 58
  116.  
  117. 59
  118.  
  119. 60
  120.  
  121. 61
  122.  
  123. 62
  124.  
  125. 63
  126.  
  127. 64
  128.  
  129. 65
  130.  
  131. 66  ---- THIS IS THE LAST LINE OF THE FIRST PAGE ---
  132.  
  133.  
  134.  
  135.      The ZMODEM Asynchronous Inter Application File Transfer Protocol
  136.  
  137.  
  138.                               Chuck Forsberg
  139.  
  140.  
  141.                            Omen Technology Inc
  142.  
  143.  
  144.  
  145.                               Chuck Forsberg
  146.  
  147.                            Omen Technology Inc
  148.  
  149.                    17505-V Northwest Sauvie Island Road
  150.  
  151.                           Portland Oregon 97231
  152.  
  153.                            Voice: 503-621-3406
  154.  
  155.             Modem (Telegodzilla): 503-621-3746 Speed 1200,300
  156.  
  157.                           Compuserve: 70715,131
  158.  
  159.                     UUCP: ...!tektronix!reed!omen!caf
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. Chapter 0               rev051486 Printed 5-16-86                        1
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. Chapter 0               rev051486 Printed 5-16-86                        2
  214.  
  215.  
  216.  
  217.  
  218. 1.  INTENDED AUDIENCE
  219.  
  220.  
  221. This document is intended for systems programmers and other technically
  222.  
  223. qualified people who choose and implement asynchronous file transfer
  224.  
  225. protocols over dial-up networks and related environments.
  226.  
  227.  
  228.  
  229. 2.  ACKNOWLEDGMENTS
  230.  
  231.  
  232. Encouragement and suggestions by Stuart Mathison, Thomas Buck, John Wales,
  233.  
  234. Ward Christensen, and Irv Hoff are gratefully acknowledged.
  235.  
  236.  
  237.  
  238. 3.  RELATED DOCUMENTS
  239.  
  240.  
  241. The following files should be available for reference while studying this
  242.  
  243. document:
  244.  
  245.  
  246. YMODEM.DOC Describes the XMODEM and YMODEM file transfer protocols
  247.  
  248.  
  249. ZMODEM.H Provides definitions for the manifest constants referenced
  250.  
  251.         herein.
  252.  
  253.  
  254. rz.c, sz.c, rbsb.c Unix source code for operating ZMODEM programs.
  255.  
  256.  
  257. rz.1, sz.1 Manual pages for rz and sz.
  258.  
  259.  
  260. zm.c, zmodem.h Operating system independent ZMODEM subroutines, header
  261.  
  262.         file.
  263.  
  264.  
  265.  
  266. 4.  ROSETTA STONE
  267.  
  268.  
  269. Here are some definitions which reflect the current vernacular in the
  270.  
  271. computer media.  The attempt here is identify the file transfer protocol
  272.  
  273. rather than specific programs.
  274.  
  275.  
  276. Frame   A ZMODEM frame consists of a header packet and 0 or more data
  277.  
  278.         packets.
  279.  
  280.  
  281. XMODEM  refers to the original 1979 file transfer etiquette introduced by
  282.  
  283.         Ward Christensen's 1979 MODEM2 program.  It's also called the
  284.  
  285.         MODEM or MODEM2 protocol.  Some who are unaware of MODEM7's
  286.  
  287.         unusual batch file mode call it MODEM7.  Other aliases include
  288.  
  289.         "CP/M Users's Group" and "TERM II FTP 3".  This protocol is
  290.  
  291.         supported by every serious communications program because of its
  292.  
  293.         universality, simplicity, and reasonable performance.
  294.  
  295.  
  296. XMODEM/CRC replaces XMODEM's 1 byte checksum with a two byte Cyclical
  297.  
  298.         Redundancy Check (CRC-16), giving modern error detection
  299.  
  300.         protection.
  301.  
  302.  
  303.  
  304.  
  305. Chapter 4               rev051486 Printed 5-16-86                        2
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314. Chapter 4               rev051486 Printed 5-16-86                        3
  315.  
  316.  
  317.  
  318.  
  319. YMODEM  refers to the XMODEM/CRC protocol with the throughput and/or batch
  320.  
  321.         transmission enhancements described in YMODEM.DOC.
  322.  
  323.  
  324. ZMODEM  Zmodem is a second generation streaming protocol for text and
  325.  
  326.         binary file transmission between applications running on
  327.  
  328.         microcomputers and mainframes.
  329.  
  330.  
  331.  
  332. 5.  WHY DEVELOP ZMODEM?
  333.  
  334.  
  335. Since its development half a decade ago, the Ward Christensen MODEM
  336.  
  337. protocol has enabled a wide variety of computer systems to interchange
  338.  
  339. data.  There is hardly a communications program that doesn't at least
  340.  
  341. claim to support this protocol, now called XMODEM.
  342.  
  343.  
  344. Advances in computing, modems and networking have spread the XMODEM
  345.  
  346. protocol far beyond the micro to micro environment for which it was
  347.  
  348. designed.  These application have exposed some weaknesses:
  349.  
  350.  
  351.    + The user interface is suitable for computer hobbyists.  Three or four
  352.  
  353.      commands must be keyboarded to transfer each file.
  354.  
  355.  
  356.    + The short block length causes throughput to suffer when used with
  357.  
  358.      timesharing systems, packet switched networks, satellite circuits,
  359.  
  360.      and buffered (error correcting) modems.
  361.  
  362.  
  363.    + The 8 bit checksum and unprotected transactions allow undetected
  364.  
  365.      errors and disrupted file transfers.
  366.  
  367.  
  368.    + Only one file can be sent per command.  The file name has to be given
  369.  
  370.      twice, first to the sending program and then again to the receiving
  371.  
  372.      program.
  373.  
  374.  
  375.    + The transmitted file accumulates as many as 127 extraneous bytes.
  376.  
  377.  
  378.    + The modification date and other file attributes are lost.
  379.  
  380.  
  381.    + XMODEM requires complete 8 bit transparency, all 256 codes.  XMODEM
  382.  
  383.      will not operate over some networks that need flow control.
  384.  
  385.  
  386. A number of other protocols have been developed over the years, but none
  387.  
  388. have displaced XMODEM to date.
  389.  
  390.  
  391.    + Lack of public domain documentation and example programs have kept
  392.  
  393.      proprietary protocols such as MNP, Blast, and others tightly bound to
  394.  
  395.      the fortunes of their suppliers.
  396.  
  397.  
  398.    + Hardware and/or software complexity discourages the widespread
  399.  
  400.      application of BISYNC, SDLC, HDLC, X.25, and X.PC protocols.
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407. Chapter 5               rev051486 Printed 5-16-86                        3
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416. Chapter 5               rev051486 Printed 5-16-86                        4
  417.  
  418.  
  419.  
  420.  
  421.    + Link level protocols such as X.25, X.PC, and MNP do not manage
  422.  
  423.      application to application file transfers.
  424.  
  425.  
  426.    + The Kermit protocol was developed to allow file transfers in
  427.  
  428.      environments hostile to XMODEM.  The performance compromises
  429.  
  430.      necessary to accomodate non transparent environments limit Kermit's
  431.  
  432.      efficiency.  Even with completely transparent channels, Kermit
  433.  
  434.      control character quoting limits the efficiency of binary file
  435.  
  436.      transfers to about 75 per cent.[1]
  437.  
  438.  
  439.      Kermit Sliding Windows ("SuperKermit") improves throughput over
  440.  
  441.      networks at the cost of increased complexity.  SuperKermit state
  442.  
  443.      transitions are encoded in a special language "wart" which requires a
  444.  
  445.      C compiler.  The SuperKermit C code requires full duplex
  446.  
  447.      communications and the ability to check for the presence of
  448.  
  449.      characters in the input queue, precluding its implementation on some
  450.  
  451.      operating systems.
  452.  
  453.  
  454.      A number of submodes are used in various Kermit programs, including
  455.  
  456.      different methods of transferring binary files.  Two Kermit programs
  457.  
  458.      will mysteriously fail to operate with each other if these submodes
  459.  
  460.      are not matched.
  461.  
  462.  
  463. A number of extensions to the XMODEM protocol have been made under the
  464.  
  465. collective name YMODEM.
  466.  
  467.  
  468.  + YMODEM-k uses 1024 byte blocks to reduce the overhead from transmission
  469.  
  470.    delays by 87 per cent compared to XMODEM, but network delays can still
  471.  
  472.    degrade performance.  Some networks may not be transmit the 1024 byte
  473.  
  474.    packets unmodified.
  475.  
  476.  
  477.  + The handling of files that are not a multiple of 1024 or 128 bytes is
  478.  
  479.    awkward, especially if the file length is not known, or changes during
  480.  
  481.    transmission.
  482.  
  483.  
  484.  + YMODEM-g provides efficient batch file transfers, preserving the exact
  485.  
  486.    file length and file modification date.  YMODEM-g is essentially
  487.  
  488.    insensitive to network delays.  Because it does not support error
  489.  
  490.    recovery, YMODEM-g is usually used hardwired or with a reliable link
  491.  
  492.    level protocol.  IF YMODEM-g detects a CRC error, data transfers are
  493.  
  494.    aborted.  YMODEM-g is easy to implement because it closely resembles
  495.  
  496.    XMODEM-CRC.
  497.  
  498.  
  499. Another XMODEM "extension" is protocol cheating, referred to as "Turbo
  500.  
  501. Download" and OverThruster.  [2] These sometimes improve XMODEM throughput
  502.  
  503.  
  504.  
  505. __________
  506.  
  507.  
  508.  1. Some Kermit programs support run length encoding.
  509.  
  510.  
  511.  
  512.  
  513.  
  514. Chapter 5               rev051486 Printed 5-16-86                        4
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523. Chapter 5               rev051486 Printed 5-16-86                        5
  524.  
  525.  
  526.  
  527.  
  528. at the expense of error recovery.
  529.  
  530.  
  531. The ZMODEM Protocol is proposed as a means of addressing the weaknesses
  532.  
  533. described above while maintaining as much of XMODEM's simplicity and prior
  534.  
  535. art as possible.
  536.  
  537.  
  538.  
  539.  
  540. 6.  ZMODEM Protocol Design Criteria
  541.  
  542.  
  543. The design of a file transfer protocol is an engineering compromise
  544.  
  545. between conflicting requirements:
  546.  
  547.  
  548. 6.1  Ease of Use
  549.  
  550.  
  551.  + ZMODEM allows either program to initiate file transfers, passing
  552.  
  553.    commands and/or modifiers to the other program.
  554.  
  555.  
  556.  + File names need be entered only once, menu selections are possible.
  557.  
  558.  
  559.  + Wild Card names may be used with batch transfers.
  560.  
  561.  
  562.  + Minimum keystrokes required to initiate transfers.
  563.  
  564.  
  565.  + ZRQINIT packet sent by sending program can trigger automatic downloads.
  566.  
  567.  
  568.  + ZMODEM can step down to YMODEM if the other end does not support
  569.  
  570.    ZMODEM.[1]
  571.  
  572.  
  573. 6.2  Throughput
  574.  
  575.  
  576. ZMODEM is designed for optimum performance with minimum degradation caused
  577.  
  578. by delays introduced by packet switched networks and timesharing systems.
  579.  
  580.  
  581. ZMODEM is optimized for best throughput when line hits occur infrequently.
  582.  
  583. This assumption markedly reduces code complexity and memory requirements.
  584.  
  585. ZMODEM protocol features enhance rapid error recovery compared to network
  586.  
  587. compatible XMODEM implementations.
  588.  
  589.  
  590. It is assumed that many transfers will originate from a timesharing system
  591.  
  592. connected to a packet switched network.  ZMODEM provides features to allow
  593.  
  594. for simple, efficient implementation on timesharing hosts.
  595.  
  596.  
  597.  
  598.  
  599. __________________________________________________________________________
  600.  
  601.  
  602.  2. Omen Technology Trademark
  603.  
  604.  
  605.  1. Provided the transmission medium accomodates YMODEM.
  606.  
  607.  
  608.  
  609.  
  610.  
  611. Chapter 6               rev051486 Printed 5-16-86                        5
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620. Chapter 6               rev051486 Printed 5-16-86                        6
  621.  
  622.  
  623.  
  624.  
  625. File transfers begin immediately regardless of which program is started
  626.  
  627. first, without the 10 second delay associated with XMODEM.
  628.  
  629.  
  630.  
  631. 6.3  Integrity and Robustness
  632.  
  633.  
  634. All packets are protected with 16 bit CRC.  Proprietary alogrithyms[2] are
  635.  
  636. not needed for reliable transfers.
  637.  
  638.  
  639. A security challenge guards againgst Trojan Horse messages.
  640.  
  641.  
  642. 6.4  Ease of Implementation
  643.  
  644.  
  645. ZMODEM accomodates a wide variety of systems:
  646.  
  647.  
  648.  + Microcomputers that cannot overlap disk and serial i/o
  649.  
  650.  
  651.  + Microcomputers that cannot overlap serial send and receive
  652.  
  653.  
  654.  + Computers and/or networks requiring XON/XOFF flow control
  655.  
  656.  
  657.  + Computers that cannot check the serial input queue for the presence of
  658.  
  659.    data without having to wait for the data to arrive.
  660.  
  661.  
  662. Although ZMODEM provides "hooks" for multiple "threads", ZMODEM is not
  663.  
  664. intended to replace link level protocols such as X.25.
  665.  
  666.  
  667. ZMODEM accomodates network and timesharing system delays by continuously
  668.  
  669. transmitting data unless the receiver interrupts the sender to request
  670.  
  671. retransmission of garbled data.  ZMODEM in effect uses the entire file as
  672.  
  673. a window.[3]
  674.  
  675.  
  676. ZMODEM provides a general purpose application to application file transfer
  677.  
  678. protocol which may be used directly or with with reliable link level
  679.  
  680. protocols such as X.25, MNP, Fastlink, etc.
  681.  
  682.  
  683.  
  684. 7.  ZMODEM BASICS
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693. __________
  694.  
  695.  
  696.  2. Unique to Professional-YAM, PowerCom, etc.
  697.  
  698.  
  699.  3. Streaming strategey is discussed in a coming chapter.
  700.  
  701.  
  702.  
  703.  
  704.  
  705. Chapter 7               rev051486 Printed 5-16-86                        6
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714. Chapter 7               rev051486 Printed 5-16-86                        7
  715.  
  716.  
  717.  
  718.  
  719. 7.1  Packetization
  720.  
  721.  
  722. ZMODEM frames somewhat different from X/YMODEM blocks.  X/YMODEM blocks
  723.  
  724. are not used for the following reasons:
  725.  
  726.  
  727.  + Block numbers are limited to 256
  728.  
  729.  
  730.  + No provision for variable length blocks
  731.  
  732.  
  733.  + Line hits corrupt protocol signals, causing failed file transfers.  In
  734.  
  735.    particular, modem errors sometimes generate false block numbers, false
  736.  
  737.    EOTs and false ACKs.  False ACKs are the most troublesome as they cause
  738.  
  739.    the sender to lose synchronization with the receiver.
  740.  
  741.  
  742.    State of the art X/YMODEM programs such as Professional-YAM and
  743.  
  744.    PowerCom overcome some of these weaknesses with clever proprietary
  745.  
  746.    code, but a stronger protocol is desired.
  747.  
  748.  
  749.  + It is difficult to determine the beginning and ends of X/YMODEM blocks
  750.  
  751.    when line hits cause a loss of synchronization.  This precludes rapid
  752.  
  753.    error recovery.
  754.  
  755.  
  756. 7.2  Link Escape Encoding
  757.  
  758.  
  759. ZMODEM acheives data transparency by extending the 8 bit character set
  760.  
  761. (256 codes) with escape sequences based on the ZMODEM data link escape
  762.  
  763. character ZDLE.[1]
  764.  
  765.  
  766. Link Escape coding permits variable length data packets without the
  767.  
  768. overhead of a separate byte count.  It allows the beginning of frames to
  769.  
  770. be detected without special timing techniques, facilitating rapid error
  771.  
  772. recovery.
  773.  
  774.  
  775. Link Escape coding does add some overhead.  The worst case, a file
  776.  
  777. consisting entirely of ZDLE characters, would incur a 50% overhead.
  778.  
  779.  
  780. The ZDLE character is special.  ZDLE represents a control sequence of some
  781.  
  782. sort.  If a ZDLE character appears in the data sent within a binary
  783.  
  784. packet, it is prefixed with ZDLE, then sent as ZDLEE.
  785.  
  786.  
  787. The value for ZDLE is octal 030 (ASCII CAN).  This particular value was
  788.  
  789. chosen to allow a string of CAN characters to abort a ZMODEM session,
  790.  
  791. compatible with X/YMODEM session abort.
  792.  
  793.  
  794.  
  795.  
  796. __________
  797.  
  798.  
  799.  1. This and other constants are defined in the zmodem.h include file.
  800.  
  801.     Please note that constants with a leading 0 are octal constants in C.
  802.  
  803.  
  804.  
  805.  
  806.  
  807. Chapter 7               rev051486 Printed 5-16-86                        7
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816. Chapter 7               rev051486 Printed 5-16-86                        8
  817.  
  818.  
  819.  
  820.  
  821. Since CAN is not used for normal terminal operations, communications
  822.  
  823. programs can monitor the data flow for ZDLE.  The following characters can
  824.  
  825. be scanned to detect the ZRQINIT packet, the invitation to automatically
  826.  
  827. download commands or files.
  828.  
  829.  
  830. Two successive CAN characters will abort a ZMODEM session.  Experience
  831.  
  832. with YMODEM file transfers suggests that this does not impair the
  833.  
  834. robustness of the protocol.  A minimum of 8 CAN are sent, so the ZMODEM
  835.  
  836. subroutines can be modified to require more successive CAN characters to
  837.  
  838. signal an abort.
  839.  
  840.  
  841. The receiving program will decode any sequence of ZDLE followed by a byte
  842.  
  843. with bit 6 set and bit 5 reset (upper case letter, either parity) to the
  844.  
  845. equivalent control character by inverting bit 6.  This allows the
  846.  
  847. transmitter to escape any control character that cannot be sent by the
  848.  
  849. communications medium.  The ZMODEM software currently escapes ZDLE, 021,
  850.  
  851. 0221, 023, and 0223.  In addition, the receiver recognizes escapes for
  852.  
  853. 0177 and 0377 should these characters need to be escaped.
  854.  
  855.  
  856. 7.3  Header Packet Information
  857.  
  858.  
  859. All ZMODEM frames begin with a header packet which may be sent in binary
  860.  
  861. or HEX form.  ZMODEM uses a single routine to recognize binary and hex
  862.  
  863. header packets.  Either form of the header packet contains the same raw
  864.  
  865. information:
  866.  
  867.  
  868.  + A type byte[2] Future extensions to ZMODEM may use the high order bits
  869.  
  870.    of the type byte to indicate thread selection.
  871.  
  872.  
  873.  + Four bytes of data indicating flags and/or numeric quantities depending
  874.  
  875.    on the packet type
  876.  
  877.  
  878.                 Figure 1.  Order of Bytes in Header Packet
  879.  
  880.  
  881.  
  882.                    TYPE:  packet Type
  883.  
  884.                    F0: Flags least significant byte
  885.  
  886.                    P0: file Position least significant
  887.  
  888.                    P3: file Position most significant
  889.  
  890.  
  891.                            TYPE  F3 F2 F1 F0
  892.  
  893.                            --------------
  894.  
  895.                            TYPE  P0 P1 P2 P3
  896.  
  897.  
  898.  
  899.  
  900. __________
  901.  
  902.  
  903.  2. The packet types are cardinal numbers beginning with 0 to minimize
  904.  
  905.     state transition table memory requirements.
  906.  
  907.  
  908.  
  909.  
  910.  
  911. Chapter 7               rev051486 Printed 5-16-86                        8
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920. Chapter 7               rev051486 Printed 5-16-86                        9
  921.  
  922.  
  923.  
  924.  
  925. 7.4  Binary Header Packet
  926.  
  927.  
  928. A binary header packet is only sent by the sending program to the
  929.  
  930. receiving program.
  931.  
  932.  
  933. A binary header packet begins with the sequence ZPAD, ZDLE, ZBIN.
  934.  
  935.  
  936. The frame type byte is ZDLE encoded.
  937.  
  938.  
  939. The four position/flags bytes are ZDLE encoded.
  940.  
  941.  
  942. A two byte CRC of the frame type and position/flag bytes is ZDLE encoded.
  943.  
  944.  
  945. 0 or more binary data packets will follow depending on the frame type.
  946.  
  947.  
  948. The function zsbhdr transmits a binary header packet.  The function
  949.  
  950. zgethdr receives a binary or hex header packet.
  951.  
  952.  
  953.                      Figure 2.  Binary Header Packet
  954.  
  955.             * * ZDLE TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2
  956.  
  957.  
  958.  
  959. 7.5  HEX Header Packet
  960.  
  961.  
  962. The receiver sends responses in hex header packets.  The sender also uses
  963.  
  964. hex header packets when they are not followed by binary data packets.
  965.  
  966.  
  967. Hex encoding is required to support XON/XOFF flow control.  The hex header
  968.  
  969. receiving routine ignores flow control characters.
  970.  
  971.  
  972. Use of Kermit style encoding for control and paritied characters was
  973.  
  974. considered and rejected because of increased possibility of interacting
  975.  
  976. with some timesharing systems's line edit functions.  Use of HEX packets
  977.  
  978. from the receiving program allows control characters to be used to
  979.  
  980. interrupt the sender when errors are detected.  Except for header packet
  981.  
  982. types that imply data packets to follow, a HEX header packet may be used
  983.  
  984. in place of a binary header packet.
  985.  
  986.  
  987. A hex header packet begins with the sequence ZPAD, ZPAD, ZDLE, ZHEX.  The
  988.  
  989. zgethdr routine synchronizes in the ZPAD-ZDELE sequence.  The extra ZPAD
  990.  
  991. allows other parts of the program to detect a ZMODEM packet and then call
  992.  
  993. zgethdr to receive the packet.
  994.  
  995.  
  996. The type byte, the four position/flag bytes, and the CRC thereof are sent
  997.  
  998. in hex using the character set 01234567890abcdef.  Upper case hex digits
  999.  
  1000. are not allowed; they false trigger X/YMODEM programs.
  1001.  
  1002.  
  1003. A carriage return, line feed, and XON are appended to the HEX header
  1004.  
  1005. packet but are not considered to be part of it.  The CR/LF aids debugging
  1006.  
  1007. from printouts.  The XON releases the sender from spurious XOFF flow
  1008.  
  1009. control characters generated by line noise, a common occurrence.
  1010.  
  1011.  
  1012.  
  1013.  
  1014. Chapter 7               rev051486 Printed 5-16-86                        9
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023. Chapter 7               rev051486 Printed 5-16-86                       10
  1024.  
  1025.  
  1026.  
  1027.  
  1028. 0 or more ASCII Encoded data packets will follow depending on the frame
  1029.  
  1030. type.
  1031.  
  1032.  
  1033. The function zshhdr sends a hex header packet.
  1034.  
  1035.  
  1036.                        Figure 3.  HEX Header Packet
  1037.  
  1038.        * * ZDLE TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CR LF XON
  1039.  
  1040.  
  1041. (TYPE, F3...F0, CRC-1, and CRC-2 are each sent as two hex digits.)
  1042.  
  1043.  
  1044.  
  1045. 7.6  Binary Data Packets
  1046.  
  1047.  
  1048. Binary data packets immediately follow the associated binary header
  1049.  
  1050. packet.  A binary data packet contains 0 to 1024 bytes of data.
  1051.  
  1052. Recommended length values are 256 bytes below 4800 bps, 1024 above 4800
  1053.  
  1054. bps or when the data link is known to be relatively error free.
  1055.  
  1056.  
  1057. No padding is used with binary data packets.  The data bytes are ZDLE
  1058.  
  1059. encoded and transmitted.  A ZDLE and frameend are then sent, followed by
  1060.  
  1061. two ZDLE encoded CRC bytes.  The CRC accumulates the data bytes and
  1062.  
  1063. frameend.
  1064.  
  1065.  
  1066. The function zsbdata sends a binary data packet.  The function zrbdata
  1067.  
  1068. receives a binary data packet.
  1069.  
  1070.  
  1071. 7.7  ASCII Encoded Data Packet
  1072.  
  1073.  
  1074. The format of ASCII Encoded data packets is not currently specified.
  1075.  
  1076. These would be used for server commands, etc.
  1077.  
  1078.  
  1079.  
  1080. 8.  PROTOCOL TRANSACTION OVERVIEW
  1081.  
  1082.  
  1083. As with the XMODEM recommendation, ZMODEM timing is receiver driven.  The
  1084.  
  1085. transmitter should not time out at all, except to abort the program if no
  1086.  
  1087. packets are received for an extended period of time, say one minute.[1]
  1088.  
  1089.  
  1090. To start a ZMODEM file transfer session, the sending program is called
  1091.  
  1092. with the names of the desired file(s) and option(s).
  1093.  
  1094.  
  1095. The sending program sends the string "rz\r" to invoke the receiving
  1096.  
  1097. program from a possible command mode.  The "rz" followed by carriage
  1098.  
  1099. return activates a ZMODEM receive program or command if it were not
  1100.  
  1101. already active.
  1102.  
  1103.  
  1104.  
  1105. __________
  1106.  
  1107.  
  1108.  1. Special considerations apply when sending commands.
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114. Chapter 8               rev051486 Printed 5-16-86                       10
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123. Chapter 8               rev051486 Printed 5-16-86                       11
  1124.  
  1125.  
  1126.  
  1127.  
  1128. The sender may then display a message intended for human consumption, such
  1129.  
  1130. as a list of the files requested, etc.
  1131.  
  1132.  
  1133. Then the sender sends a ZRQINIT packet.  The ZRQINIT packet causes a
  1134.  
  1135. previously started receive program to send its ZRINIT packet without
  1136.  
  1137. delay.
  1138.  
  1139.  
  1140. In an interactive or conversational mode, the receiving application may
  1141.  
  1142. monitor the data stream for ZDLE.  The following characters may be scanned
  1143.  
  1144. for B000000 indicating a ZRQINIT packet, a command to download a command
  1145.  
  1146. or data.
  1147.  
  1148.  
  1149. The sending program awaits a command from the receiving program to start
  1150.  
  1151. file transfers.  If a "C", "G", or NAK is received, an XMODEM or YMODEM
  1152.  
  1153. file transfer is indicated, and file transfer(s) use the X/YMODEM
  1154.  
  1155. protocol.  Note: With ZMODEM and YMODEM Batch, the sending program
  1156.  
  1157. provides the file name, but not with XMODEM.
  1158.  
  1159.  
  1160. When the ZMODEM receive program starts, it immediately sends a ZRINIT
  1161.  
  1162. packet to initiate ZMODEM file transfers, or a ZCHALLENGE packet to verify
  1163.  
  1164. the sending program.  The receive program resends its packet at repsonse
  1165.  
  1166. time intervals for a suitable period of time (40 seconds typical) before
  1167.  
  1168. falling back to X/YMODEM protocol.  If the receiving program receives a
  1169.  
  1170. ZRQINIT packet, it resends the ZRINIT packet.  If the sending program
  1171.  
  1172. receives the ZCHALLENGE packet, it places the data in ZP0...ZP3 in an
  1173.  
  1174. answering ZACK packet.
  1175.  
  1176.  
  1177. If the receiving program receives a ZRINIT packet, it is an echo
  1178.  
  1179. indicating that the sending program is not operational.
  1180.  
  1181.  
  1182. Eventually the sending program correctly receives the ZRINIT packet.
  1183.  
  1184.  
  1185. The sender may then respond with an optional ZSINIT frame to set the
  1186.  
  1187. receiving program's Attention string.  The receiver sends a ZACK packet in
  1188.  
  1189. response, containing the serial number of the receiving program, or 0.
  1190.  
  1191.  
  1192. The sender then sends a ZFILE header with ZMODEM Conversion, Management,
  1193.  
  1194. and Transport options[2] followed by a ZCRCW data packet containing the
  1195.  
  1196. file name, file length, modification date, and other information identical
  1197.  
  1198. to that used by YMODEM Batch.
  1199.  
  1200.  
  1201. The receiving program should insure the pathname and options are
  1202.  
  1203. compatible with its operating environment and local security requirements.
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209. __________
  1210.  
  1211.  
  1212.  2. See below, under ZFILE packet type.
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218. Chapter 8               rev051486 Printed 5-16-86                       11
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227. Chapter 8               rev051486 Printed 5-16-86                       12
  1228.  
  1229.  
  1230.  
  1231.  
  1232.        If the receiver has a file with the same name and length,
  1233.  
  1234.        it may respond with a ZCRC packet, which requires the
  1235.  
  1236.        sender to permorm a 16 bit CRC on the file and transmit the
  1237.  
  1238.        CRC in ZP0...ZP1 of a ZCRC packet.  The receiver uses this
  1239.  
  1240.        information to determine whether to accept the file or skip
  1241.  
  1242.        it.  This sequence is triggered by the ZMCRC Management
  1243.  
  1244.        Option.
  1245.  
  1246.  
  1247. The receiver may then respond with a ZSKIP packet, which causes the
  1248.  
  1249. sender to process the next file (if any) in the batch.
  1250.  
  1251.  
  1252. A ZRPOS packet from the receiver initiates transmission of the file data
  1253.  
  1254. starting at the offset in the file specified in the ZRPOS packet.
  1255.  
  1256. Normally the receiver specifies the data transfer begin begin at offset 0
  1257.  
  1258. in the file.
  1259.  
  1260.        The receiver may start the transfer further down in the
  1261.  
  1262.        file.  This allows a file transfer interrupted by a loss
  1263.  
  1264.        or carrier or system crash to be completed on the next
  1265.  
  1266.        connection without requiring the entire file to be
  1267.  
  1268.        retransmitted.[3] If downloading a file from a timesharing
  1269.  
  1270.        system that becomes sluggish, the transfer can be
  1271.  
  1272.        interrupted and resumed later with no loss of data.
  1273.  
  1274.  
  1275. The sender sends a ZDATA binary header packet (with file position)
  1276.  
  1277. followed by one or more data packets.
  1278.  
  1279.  
  1280. The receiver compares the file position in the ZDATA header with the
  1281.  
  1282. number of characters successfully received to the file.  If they do not
  1283.  
  1284. agree, a ZRPOS error response is generated to force the sender to the
  1285.  
  1286. right position within the file.[4]
  1287.  
  1288.  
  1289. A data packet terminated by ZCRCGO and CRC does not elicit a response
  1290.  
  1291. unless an error is detected; more data packet(s) follow immediately.
  1292.  
  1293.  
  1294.        ZCRCQ data packets expect a ZACK response (with the file
  1295.  
  1296.        offset) if no error, otherwise a ZRPOS response (with the
  1297.  
  1298.        last good file offset).  Another data packet continues
  1299.  
  1300.        immediately.  ZCRCQ packets are not used if the receiver
  1301.  
  1302.        does not indicate FDX ability with the CANFDX bit.
  1303.  
  1304.  
  1305. ZCRCW data packets expect a response before the next frame is sent.  If
  1306.  
  1307. the receiver does not indicate overlapped I/O capability with the
  1308.  
  1309.  
  1310.  
  1311. __________
  1312.  
  1313.  
  1314.  3. This does not apply to files that have been translated.
  1315.  
  1316.  
  1317.  4. If the ZMSPARS option is used, the receiver instead seeks to position
  1318.  
  1319.     in the ZDATA packet.
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325. Chapter 8               rev051486 Printed 5-16-86                       12
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334. Chapter 8               rev051486 Printed 5-16-86                       13
  1335.  
  1336.  
  1337.  
  1338.  
  1339. CANOVIO bit, or by setting a buffer size, the sender uses the ZCRCW to
  1340.  
  1341. allow the receiver to write its buffer before sending more data.
  1342.  
  1343.  
  1344.        A zero length data frame may be used as a sending idle
  1345.  
  1346.        packet to prevent the receiver from timing out in case
  1347.  
  1348.        data is not immediately available to the sender.
  1349.  
  1350.  
  1351. In the absence of fatal error, the sender eventually encounters end of
  1352.  
  1353. file.  If the end of file is encountered within a frame, the frame is
  1354.  
  1355. closed with a ZCRCE data packet which does not elicit a response
  1356.  
  1357. except in case of error.
  1358.  
  1359.  
  1360. The sender sends a ZEOF packet with the file ending offset equal to
  1361.  
  1362. the number of characters in the file.  The receiver compares this
  1363.  
  1364. number with the number of characters received.  If the receiver has
  1365.  
  1366. received all of the file, it closes the file.  If the file close was
  1367.  
  1368. satisfactory, the receiver responds with ZRINIT.  If the receiver has
  1369.  
  1370. not received all the bytes of the file, the receiver sends ZRPOS with
  1371.  
  1372. the current file offset, forcing the sender to resend the missing
  1373.  
  1374. data.  (If the receiver cannot properly close the file, a ZFERR packet
  1375.  
  1376. is sent.)
  1377.  
  1378.  
  1379.        After all files are processed, any further protocol
  1380.  
  1381.        errors should not prevent the sending program from
  1382.  
  1383.        returning with a success status.
  1384.  
  1385.  
  1386. The sender closes the session with a ZEXIT header packet.  The
  1387.  
  1388. receiver acknowledges this with its own ZEXIT packet.
  1389.  
  1390.  
  1391. When the sender receives the acknowledging packet, it sends two
  1392.  
  1393. characters, "OO" (Over and Out) and exits to the operating system or
  1394.  
  1395. application that invoked it.  The receiver waits briefly for the "O"
  1396.  
  1397. characters, then exits whether they were received or not.
  1398.  
  1399.  
  1400. 8.1  Session Cancel Packet
  1401.  
  1402.  
  1403. The Cancel packet consists of two ZPAD characters, eight CAN
  1404.  
  1405. characters, and an optional ten backspace characters.  First, the
  1406.  
  1407. Attn sequence is executed if the receiving program has been receiving
  1408.  
  1409. data in streaming mode.  The ZPAD characters allow sending programs
  1410.  
  1411. that sample the reverse data stream to check for a single character
  1412.  
  1413. code indicating a packet from the receiver.  The trailing backspace
  1414.  
  1415. characters attempt to erase the effects of the other characters if
  1416.  
  1417. they are received by a command interpreter.
  1418.  
  1419.  
  1420.         static char canistr[] = {
  1421.  
  1422. ZPAD,ZPAD,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0         };
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431. Chapter 9               rev051486 Printed 5-16-86                       13
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440. Chapter 9               rev051486 Printed 5-16-86                       14
  1441.  
  1442.  
  1443.  
  1444.  
  1445. 9.  ZMODEM STREAMING TECHNIQUES
  1446.  
  1447.  
  1448. ZMODEM allows choices of several data streaming methods selected
  1449.  
  1450. according to the limitations of the sending environment, receiving
  1451.  
  1452. environment, and transmission channel(s).
  1453.  
  1454.  
  1455.  
  1456. 9.1  Full Streaming with Sampling
  1457.  
  1458.  
  1459. If the computers can overlap serial I/O with disk I/O, and if the
  1460.  
  1461. sender can sample the reverse channel for the presence of data
  1462.  
  1463. without having to wait, full streaming can be used with no Attn
  1464.  
  1465. sequence required.  The sender begins data transmission with a ZDATA
  1466.  
  1467. header and continuous ZCRCG data packets.  When the receiver detects
  1468.  
  1469. an error, it executes the Attn sequence and then sends a ZRPOS packet
  1470.  
  1471. to force the sender back to the correct position within the file.  At
  1472.  
  1473. the end of each transmitted packet, the sender checks for the
  1474.  
  1475. presence of an error packet from the receiver.  To do this, the
  1476.  
  1477. sender may sample the reverse data stream for the presence of a ZPAD
  1478.  
  1479. character.
  1480.  
  1481.  
  1482. Such a program would sample the reverse channel for ZPAD.  If seen,
  1483.  
  1484. an empty ZCRCW data packet is sent (in case the receiver was still
  1485.  
  1486. reading packets) and then the receiver's response packet is read and
  1487.  
  1488. acted upon.  The code fragment in sz.c beginning at NOTDEF_DOS would
  1489.  
  1490. perform this function.
  1491.  
  1492.  
  1493.  
  1494. 9.2  Full Streaming with Interrupt
  1495.  
  1496.  
  1497. The method above cannot be used if if the reverse data stream cannot
  1498.  
  1499. be sampled without entering an I/O wait.  An alternate method is to
  1500.  
  1501. instruct the receiver to interrupt the sending program when an error
  1502.  
  1503. is detected.
  1504.  
  1505.  
  1506. The receiver can interrupt the sender with a control character, break
  1507.  
  1508. signal, or combination thereof, as specified in the ZSINIT frame sent
  1509.  
  1510. by the sending program.
  1511.  
  1512.  
  1513. When the sending program "catches" this interrupt, it reads a HEX
  1514.  
  1515. packet (normally ZRPOS) from the receiver and takes appropriate
  1516.  
  1517. action.  The Unix sb.c program uses a setjmp/longjmp call and the
  1518.  
  1519. getinsync() function to read the receiver's error packet and take
  1520.  
  1521. appropriate action.
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533. Chapter 9               rev051486 Printed 5-16-86                       14
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542. Chapter 9               rev051486 Printed 5-16-86                       15
  1543.  
  1544.  
  1545.  
  1546.  
  1547. 9.3  Full Streaming with a Sliding Window
  1548.  
  1549.  
  1550. If none of the above methods is applicable, hope is not yet lost.  If
  1551.  
  1552. the sender can buffer responses from the receiver, the sender can use
  1553.  
  1554. ZCRCQ packets to get ACKs from the receiver without interrupting the
  1555.  
  1556. transmission of data.  After a sufficient number of ZCRCQ packets
  1557.  
  1558. have been sent, the sender can read one of the one or more packets
  1559.  
  1560. that should have arrived in it's receive interrupt buffer.
  1561.  
  1562.  
  1563. A problem with this method is the probability of wasting an excessive
  1564.  
  1565. amount of time responding to the receiver's error packet.
  1566.  
  1567.  
  1568. 9.4  No Streaming
  1569.  
  1570.  
  1571. If the receiver cannot overlap serial and disk I/O, it uses the
  1572.  
  1573. ZRINIT frame to specify a buffer length which the sender will not
  1574.  
  1575. overflow.  The sending program sends a ZCRCW packet and waits for an
  1576.  
  1577. ZACK packet before sending the next segment of the file.
  1578.  
  1579.  
  1580. If the sending program supports reverse data stream sampling or
  1581.  
  1582. interrupt, error recovery will be faster (on average) than a protocol
  1583.  
  1584. (such as YMODEM) that sends "monolithic" blocks.
  1585.  
  1586.  
  1587.  
  1588. 10.  ATTENTION SEQUENCE
  1589.  
  1590.  
  1591. The receiving program sends the Attn sequence whenever it detects an
  1592.  
  1593. error and needs to interrupt the sending program.
  1594.  
  1595.  
  1596. The default Attn string value is empty (no Attn sequence).  The
  1597.  
  1598. receiving program resets Attn to the empty default before each
  1599.  
  1600. transfer session.
  1601.  
  1602.  
  1603. The sender speficies the Attn sequence in its optional ZSINIT frame.
  1604.  
  1605. The Attn string is terminated with a null.
  1606.  
  1607.  
  1608. Two meta-characters perform special functions:
  1609.  
  1610.  
  1611.    + \335 (octal) Sends a break signal
  1612.  
  1613.  
  1614.    + \336 (octal) Pauses one second
  1615.  
  1616.  
  1617.  
  1618. 11.  PACKET/FRAME TYPES
  1619.  
  1620.  
  1621. The numeric values for the values shown in boldface are given in
  1622.  
  1623. zmodem.h.
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632. Chapter 11              rev051486 Printed 5-16-86                       15
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641. Chapter 11              rev051486 Printed 5-16-86                       16
  1642.  
  1643.  
  1644.  
  1645.  
  1646. 11.1  ZRQINIT
  1647.  
  1648.  
  1649. Sent once by the sending program, to trigger the receiving program to
  1650.  
  1651. send its ZRINIT packet.  This aviods the aggravatimg startup delay
  1652.  
  1653. associated with XMODEM and Kermit transfers.
  1654.  
  1655.  
  1656. ZF0 contains ZCOMMAND if the program is attempting to send a command,
  1657.  
  1658. 0 otherwise.
  1659.  
  1660.  
  1661. 11.2  ZRINIT
  1662.  
  1663.  
  1664. Sent by the receiving program.  ZF0 and ZF1 contain the  bitwise or
  1665.  
  1666. of the receiver capability flags:
  1667.  
  1668. #define CANFDX  1 /* Rx can send and receive FDX */
  1669.  
  1670. #define CANOVIO 2 /* Rx can receive during disk I/O */
  1671.  
  1672. #define CANBRK  4 /* Rx can send a break signal */
  1673.  
  1674. #define CANCRY  8 /* Receiver can decrypt */
  1675.  
  1676.  
  1677. ZP0 and ZP1 contain the size of the receiver's buffer in bytes, or 0
  1678.  
  1679. if nonstop I/O is allowed.
  1680.  
  1681.  
  1682. 11.3  ZSINIT
  1683.  
  1684.  
  1685. Sender sends capability flags (currently all 0) (none currently
  1686.  
  1687. defined) followed by a binary data packet terminated with ZCRCW.  The
  1688.  
  1689. data packet contains the null terminated Attn sequence, maximum
  1690.  
  1691. length 32 bytes including the terminating null.
  1692.  
  1693.  
  1694. 11.4  ZACK
  1695.  
  1696.  
  1697. Acknowedgement to ZSINIT header packet, ZCHALLENGE header packet, or
  1698.  
  1699. ZCRCW data packet.  ZP0 to ZP3 contain file offset.  Response to
  1700.  
  1701. ZCHALLENGE contains the same 32 bits as received.
  1702.  
  1703.  
  1704. 11.5  ZFILE
  1705.  
  1706.  
  1707. This packet denotes the beginning of a file transmission attempt.
  1708.  
  1709. ZF0, ZF1, and ZF2 may contain options.  A value of 0 in each of these
  1710.  
  1711. bytes implies no special treatment.  If options are specified to the
  1712.  
  1713. reciever, they override options specified to the sender with the
  1714.  
  1715. exception of the ZCBIN option, which overrides any other Conversion
  1716.  
  1717. Option.
  1718.  
  1719.  
  1720.  
  1721. 11.5.1  ZF0: Conversion Option
  1722.  
  1723. If the receiver does not recognize the Conversion Option, an
  1724.  
  1725. application dependent default conversion may apply.
  1726.  
  1727.  
  1728. ZCBIN "Binary" transfer - inhibit conversion unconditionally
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735. Chapter 11              rev051486 Printed 5-16-86                       16
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744. Chapter 11              rev051486 Printed 5-16-86                       17
  1745.  
  1746.  
  1747.  
  1748.  
  1749. ZCNL Convert received end of line to local end of line convention.
  1750.  
  1751.      The suported end line conventions are CR/LF (most ASCII based
  1752.  
  1753.      operating systems except Unix and Macintosh), and NL (Unix).
  1754.  
  1755.      Neither of these two end of line conventions violate the
  1756.  
  1757.      permissible ASCII definitions for Carriage Return and Line
  1758.  
  1759.      Feed/New Line.
  1760.  
  1761.  
  1762. ZCRECOV Recover interrupted file transfer; start transfer at location
  1763.  
  1764.      corresponding to the receiver's end of file.  This option does
  1765.  
  1766.      not apply if the source file is shorter.  Files that have been
  1767.  
  1768.      converted (e.g., ZCNL) or subject to a single ended Transport
  1769.  
  1770.      Option cannot have their transfers recovered.
  1771.  
  1772.  
  1773. 11.5.2  ZF1: Management Option
  1774.  
  1775. If the receiver does not recognize the Management Option, the file
  1776.  
  1777. should be transferred normally.
  1778.  
  1779.  
  1780. ZMNEW Compare the source and destination files.  Transfer file if
  1781.  
  1782.      source newer or different length
  1783.  
  1784.  
  1785. ZMCRC Compare the source and destination files.  Transfer if
  1786.  
  1787.      different file length or CRC
  1788.  
  1789.  
  1790. ZMAPND Append source file contents to existing destination file (if
  1791.  
  1792.      any)
  1793.  
  1794.  
  1795. ZMCLOB Replace existing destination file (if any)
  1796.  
  1797.  
  1798. ZTSPARS Special processing for sparse file; each file segment is
  1799.  
  1800.      transmitted as a separate frame, where the frames are not
  1801.  
  1802.      necessarily contiguous.
  1803.  
  1804.  
  1805. 11.5.3  ZF2: Transport Option
  1806.  
  1807. If the receiver does not implement the particular transport option,
  1808.  
  1809. the file is copied without conversion for later processing.
  1810.  
  1811.  
  1812. ZTLZW Lempel-Ziv compression.  Transmitted data will be identical to
  1813.  
  1814.      that produced by compress 4.0 operating on a computer with VAX
  1815.  
  1816.      byte ordering, using 12 bit encoding.
  1817.  
  1818.  
  1819. ZTCRYPT Encryption.  An initial null terminated string identifies the
  1820.  
  1821.      key.  Details to be determined.
  1822.  
  1823.  
  1824. ZTRLE Run Length encoding Details to be determined.
  1825.  
  1826.  
  1827. A ZCRCW data packet follows with file name, file length, modification
  1828.  
  1829. date, and other information described in a later chapter.
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838. Chapter 11              rev051486 Printed 5-16-86                       17
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847. Chapter 11              rev051486 Printed 5-16-86                       18
  1848.  
  1849.  
  1850.  
  1851.  
  1852. 11.6  ZSKIP
  1853.  
  1854.  
  1855. Sent by the receiver in response to ZFILE, makes the sender skip to
  1856.  
  1857. the next file.
  1858.  
  1859.  
  1860. 11.7  ZNAK
  1861.  
  1862.  
  1863. Indicates last packet header was garbled.  (See also ZRPOS).
  1864.  
  1865.  
  1866. 11.8  ZABORT
  1867.  
  1868.  
  1869. Sent by receiver to terminate batch file transfers when requested by
  1870.  
  1871. the user.  Sender initiates a ZFIN sequence.[1]
  1872.  
  1873.  
  1874. 11.9  ZFIN
  1875.  
  1876.  
  1877. Sent by sending program to terminate a ZMODEM session.  Receiver
  1878.  
  1879. responds with ZFIN.
  1880.  
  1881.  
  1882. 11.10  ZRPOS
  1883.  
  1884.  
  1885. Sent by receiver to force file transfer to resume at file offset
  1886.  
  1887. given in ZP0...ZP3.
  1888.  
  1889.  
  1890. 11.11  ZDATA
  1891.  
  1892.  
  1893. ZP0...ZP3 contain file offset.  One or more data packets follow.
  1894.  
  1895.  
  1896. 11.12  ZEOF
  1897.  
  1898.  
  1899. Sender reports End of File.  ZP0...ZP3 contain the ending file
  1900.  
  1901. offset.
  1902.  
  1903.  
  1904. 11.13  ZFERR
  1905.  
  1906.  
  1907. Error in reading or writing file, protocol equivalent to ZABORT.
  1908.  
  1909.  
  1910. 11.14  ZCRC
  1911.  
  1912.  
  1913. Request (receiver) and response (sender) for file CRC.  ZP0 and ZP1
  1914.  
  1915. contain 16 bit file CRC.
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923. __________
  1924.  
  1925.  
  1926.  1. Or ZCOMPL in case of server mode.
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932. Chapter 11              rev051486 Printed 5-16-86                       18
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941. Chapter 11              rev051486 Printed 5-16-86                       19
  1942.  
  1943.  
  1944.  
  1945.  
  1946. 11.15  ZCHALLENGE
  1947.  
  1948.  
  1949. Request to echo a random number in ZP0...ZP3 in a ZACK frame.  Sent
  1950.  
  1951. by the receiving program to the sending program to verify that it is
  1952.  
  1953. connected to an operating program, and was not activated by spurious
  1954.  
  1955. data or a Trojan Horse message.
  1956.  
  1957.  
  1958. 11.16  ZCOMPL
  1959.  
  1960.  
  1961. Request now completed.
  1962.  
  1963.  
  1964. 11.17  ZCAN
  1965.  
  1966.  
  1967. This is a pseudo frame type returned by gethdr() in response to a
  1968.  
  1969. Cancel sequence.
  1970.  
  1971.  
  1972. 11.18  ZFREECNT
  1973.  
  1974.  
  1975. Sending program requests a ZACK frame with ZP0...ZP3 containing the
  1976.  
  1977. number of free bytes on the current file system.  A value of 0
  1978.  
  1979. represents an indefinite amount of free space.
  1980.  
  1981.  
  1982. 11.19  ZCOMMAND
  1983.  
  1984.  
  1985. ZCOMMAND is only sent as a binary header packet.  ZP0...ZP2 contain a
  1986.  
  1987. unique cardinal number to differentiate this command from other
  1988.  
  1989. commands[2].  ZF0 contains 0 or ZCACK1.
  1990.  
  1991.  
  1992.  
  1993. A ZCRCW data packet follows, with the ASCII text command string
  1994.  
  1995. terminated with a NULL character.  If the command is intended to be
  1996.  
  1997. executed by the operating system hosting the receiving program (e.g.,
  1998.  
  1999. "shell escape"), it must have "!" as the first character.  Otherwise
  2000.  
  2001. the command is meant to be executed by the application program which
  2002.  
  2003. received the command.
  2004.  
  2005.  
  2006. If ZF0 contained ZCACK1, the receiver immediately responds with a
  2007.  
  2008. ZCOMPL header.  Otherwise, the receiver responds with a ZCOMPL header
  2009.  
  2010. when the operation is completed.
  2011.  
  2012.  
  2013. The exit status of the completed command is stored in ZP0...ZP3 (0 if
  2014.  
  2015. ZCACK1).  A 0 exit status implies nominal completion of the command.
  2016.  
  2017.  
  2018. If the command caused a file to be transmitted, the command sender
  2019.  
  2020. will see a ZRQINIT frame from the other computer attempting to send
  2021.  
  2022.  
  2023.  
  2024. __________
  2025.  
  2026.  
  2027.  2. Currently unused.
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033. Chapter 11              rev051486 Printed 5-16-86                       19
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042. Chapter 11              rev051486 Printed 5-16-86                       20
  2043.  
  2044.  
  2045.  
  2046.  
  2047. data.
  2048.  
  2049.  
  2050. The sender examines ZF0 of the received ZRQINIT packet to determine
  2051.  
  2052. it is not an echo of its own ZRQINIT packet.  It is illegal for the
  2053.  
  2054. sending program to command the receiving program to send a command.
  2055.  
  2056.  
  2057.  
  2058.  
  2059. 12.  TRANSACTION EXAMPLE
  2060.  
  2061.  
  2062. 12.1  A simple file transfer
  2063.  
  2064.  
  2065. A simple transaction, one file, no errors, no CHALLENGE, overlapped
  2066.  
  2067. I/O:
  2068.  
  2069.  
  2070. Sender          Receiver
  2071.  
  2072.  
  2073. "rz\r"
  2074.  
  2075. ZRQINIT(0)
  2076.  
  2077.                 ZRINIT
  2078.  
  2079. ZFILE
  2080.  
  2081.                 ZRPOS
  2082.  
  2083. ZDATA data ...
  2084.  
  2085. ZEOF
  2086.  
  2087.                 ZRINIT
  2088.  
  2089. ZFIN
  2090.  
  2091.                 ZFIN
  2092.  
  2093. OO
  2094.  
  2095.  
  2096.  
  2097. 12.2  Challenge and Command Download
  2098.  
  2099.  
  2100.  
  2101. Sender          Receiver
  2102.  
  2103.  
  2104. "rz\r"
  2105.  
  2106. ZRQINIT(ZCOMMAND)
  2107.  
  2108.                 ZCHALLENGE(rnd)
  2109.  
  2110. ZACK(same-rnd)
  2111.  
  2112.                 ZRINIT
  2113.  
  2114. ZCOMMAND
  2115.  
  2116.                 (Perform Command)
  2117.  
  2118.                 ZCOMPL
  2119.  
  2120. ZFIN
  2121.  
  2122.                 ZFIN
  2123.  
  2124. OO
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134. Chapter 13              rev051486 Printed 5-16-86                       20
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143. Chapter 13              rev051486 Printed 5-16-86                       21
  2144.  
  2145.  
  2146.  
  2147.  
  2148. 13.  ZFILE FRAME FILE INFORMATION
  2149.  
  2150.  
  2151. ZMODEM sends the same file information with the ZFILE frame data that
  2152.  
  2153. YMODEM Batch sends in its block 0.
  2154.  
  2155.  
  2156. N.B.: Only the pathname (file name) part is required for batch
  2157.  
  2158. transfers.
  2159.  
  2160.  
  2161. Pathname The pathname (conventionally, the file name) is sent as a
  2162.  
  2163.      null terminated ASCII string.  This is the filename format used
  2164.  
  2165.      by the handle oriented MSDOS(TM) functions and C library fopen
  2166.  
  2167.      functions.  An assembly language example follows:
  2168.  
  2169.                            DB      'foo.bar',0
  2170.  
  2171.      No spaces are included in the pathname.  Normally only the file
  2172.  
  2173.      name stem (no directory prefix) is transmitted unless the sender
  2174.  
  2175.      has selected YAM's f option to send the full relative pathname.
  2176.  
  2177.      The source drive designator (A:, B:, etc.) is not sent.
  2178.  
  2179.  
  2180.      Filename Considerations:
  2181.  
  2182.  
  2183.         + File names should be translated to lower case unless the
  2184.  
  2185.           sending system supports upper/lower case file names.  This
  2186.  
  2187.           is a convenience for users of systems (such as Unix) which
  2188.  
  2189.           store filenames in upper and lower case.
  2190.  
  2191.  
  2192.         + The receiver should accommodate file names in lower and
  2193.  
  2194.           upper case.
  2195.  
  2196.  
  2197.         + The rb(1) program on Unix systems normally translates the
  2198.  
  2199.           filename to lower case unless one or more letters in the
  2200.  
  2201.           filename are already in lower case.
  2202.  
  2203.  
  2204.         + When transmitting files between different operating
  2205.  
  2206.           systems, file names must be acceptable to both the sender
  2207.  
  2208.           and receiving operating systems.
  2209.  
  2210.  
  2211.      If directories are included, they are delimited by /; i.e.,
  2212.  
  2213.      "subdir/foo" is acceptable, "subdir\foo" is not.
  2214.  
  2215.  
  2216. Length The file length and each of the succeeding fields are
  2217.  
  2218.      optional.[1] The length field is stored as a decimal string
  2219.  
  2220.      counting the number of data bytes in the file.
  2221.  
  2222.  
  2223.      With ZMODEM, the receiver uses the file length only for display
  2224.  
  2225.      (progress reporting) purposes; the actual length is determined
  2226.  
  2227.  
  2228.  
  2229. __________
  2230.  
  2231.  
  2232.  1. Fields may not be skipped.
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238. Chapter 13              rev051486 Printed 5-16-86                       21
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247. Chapter 13              rev051486 Printed 5-16-86                       22
  2248.  
  2249.  
  2250.  
  2251.  
  2252.      by the data transfer.
  2253.  
  2254.  
  2255. Modification Date A single space separates the modification date from
  2256.  
  2257.      the file length.
  2258.  
  2259.  
  2260.      The mod date is optional, and the filename and length may be
  2261.  
  2262.      sent without requiring the mod date to be sent.
  2263.  
  2264.  
  2265.      The mod date is sent as an octal number giving the time the
  2266.  
  2267.      contents of the file were last changed measured in seconds from
  2268.  
  2269.      Jan 1 1970 Universal Coordinated Time (GMT).  A date of 0
  2270.  
  2271.      implies the modification date is unknown and should be left as
  2272.  
  2273.      the date the file is received.
  2274.  
  2275.  
  2276.      This standard format was chosen to eliminate ambiguities arising
  2277.  
  2278.      from transfers between different time zones.
  2279.  
  2280.  
  2281.      Two Microsoft blunders complicate the use of modification dates
  2282.  
  2283.      in file transfers with MSDOS(TM) systems.  The first is the lack
  2284.  
  2285.      of timezone standardization in MS-DOS.  A file's creation time
  2286.  
  2287.      can not be known unless the timezone of the system that wrote
  2288.  
  2289.      the file[2] is known.  Unix solved this problem (for planet
  2290.  
  2291.      Earth, anyway) by stamping files with Universal Time (GMT).
  2292.  
  2293.      Microsoft would have to include the timezone of origin in the
  2294.  
  2295.      directory entries, but does not.  Professional-YAM gets around
  2296.  
  2297.      this problem by using the z parameter which is set to the number
  2298.  
  2299.      of minutes local time lags GMT.  For files known to originate
  2300.  
  2301.      from a different timezone, the -zT option may be used to specify
  2302.  
  2303.      T as the timezone for an individual file transfer.
  2304.  
  2305.  
  2306.      The second problem is the lack of a separate file creation date
  2307.  
  2308.      in DOS.  Since some backup schemes used with DOS rely on the
  2309.  
  2310.      file creation date to select files to be copied to the archive,
  2311.  
  2312.      back-dating the file modification date could interfere with the
  2313.  
  2314.      safety of the transferred files.  For this reason,
  2315.  
  2316.      Professional-YAM does not modify the date of received files with
  2317.  
  2318.      the header information unless the d parameter is non zero.
  2319.  
  2320.  
  2321.  
  2322. Mode A single space separates the file mode from the modification
  2323.  
  2324.      date.  The file mode is stored as an octal string.  Unless the
  2325.  
  2326.      file originated from a Unix system, the file mode is set to 0.
  2327.  
  2328.      rb(1) checks the file mode for the 0x8000 bit which indicates a
  2329.  
  2330.      Unix type regular file.  Files with the 0x8000 bit set are
  2331.  
  2332.      assumed to have been sent from another Unix (or similar) system
  2333.  
  2334.  
  2335.  
  2336. __________
  2337.  
  2338.  
  2339.  2. Not necessarily that of the transmitting system!
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345. Chapter 13              rev051486 Printed 5-16-86                       22
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Chapter 13              rev051486 Printed 5-16-86                       23
  2355.  
  2356.  
  2357.  
  2358.  
  2359.      which uses the same file conventions.  Such files are not
  2360.  
  2361.      translated in any way.
  2362.  
  2363.  
  2364.  
  2365. Serial Number A single space separates the serial number from the
  2366.  
  2367.      file mode.  The serial number of the transmitting program is
  2368.  
  2369.      stored as an octal string.  Programs which do not have a serial
  2370.  
  2371.      number should omit this field, or set it to 0.  The receiver's
  2372.  
  2373.      use of this field is optional.
  2374.  
  2375.  
  2376. The file information is terminated by a null.  If only the pathname
  2377.  
  2378. is sent, the pathname will be terminated by two nulls.  The length of
  2379.  
  2380. the file information packet, including the trailing null, must not
  2381.  
  2382. exceed 1024 bytes; a typical length is less than 64 bytes.
  2383.  
  2384.  
  2385.  
  2386. 14.  PERFORMANCE RESULTS
  2387.  
  2388.  
  2389. 14.1  Throughput
  2390.  
  2391.  
  2392. Between two single task PC-XT computrers, on a Telenet link through
  2393.  
  2394. the local Telenet, SuperKermit gave 72 ch/sec throughput at 1200
  2395.  
  2396. baud.  YMODEM-k yielded 85 chars/sec, and ZMODEM provided 113 chat
  2397.  
  2398. sec.  ZMODEM was not measured, but would have given much less.
  2399.  
  2400.  
  2401. 14.2  Error Recovery
  2402.  
  2403.  
  2404. Some tests of ZMODEM protocol performance have been made.  A PC-AT
  2405.  
  2406. with SCO SYS V Xenix or DOS 3.1 was connected to a PC with DOS 2.1
  2407.  
  2408. either directly at 9600 bps or with unbuffered dial-up 1200 bps
  2409.  
  2410. modems.  The ZMODEM software was configured to use 1024 byte packet
  2411.  
  2412. lengths above 2400 bps, 256 otherwise.
  2413.  
  2414.  
  2415. Because no time delays are necessary in normal file transfers, per
  2416.  
  2417. file negotiations are much faster than with YMODEM, the only observed
  2418.  
  2419. impidiment being the time required by the program(s) to update
  2420.  
  2421. logging files.
  2422.  
  2423.  
  2424. During a file transfer, a short line hit seen by the receiver usually
  2425.  
  2426. induces a CRC error.  The interrupt packet is usually seen by the
  2427.  
  2428. sender before the next packet is sent, and the resultant loss of data
  2429.  
  2430. throughput averages about half a packet.  At 1200 bps this is would
  2431.  
  2432. be about .75 second lost per hit.  At 10-5 error rate, this would
  2433.  
  2434. degrade throughput by about 9 per cent.  The throughput degradation
  2435.  
  2436. increases with the channel delay, as the packets in transit through
  2437.  
  2438. the channel are discarded on error.
  2439.  
  2440.  
  2441. A longer noise burst that affects both the receiver and the sender's
  2442.  
  2443. reception of the interrupt packet usually causes the sender to remain
  2444.  
  2445. silent until the receiver times out in 10 seconds.  If the round trip
  2446.  
  2447. channel delay exceeds the receiver's 10 second timeout, recovery from
  2448.  
  2449.  
  2450.  
  2451.  
  2452. Chapter 14              rev051486 Printed 5-16-86                       23
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461. Chapter 14              rev051486 Printed 5-16-86                       24
  2462.  
  2463.  
  2464.  
  2465.  
  2466. this type of error may become difficult.
  2467.  
  2468.  
  2469. Noise affecting only the sender is usually ignored, with one common
  2470.  
  2471. exception.  Spurious XOFF characters generated by noise stop the
  2472.  
  2473. sender until the receiver times out and sends an interrupt packet
  2474.  
  2475. which concludes with an XON.
  2476.  
  2477.  
  2478. In summation, ZMODEM performance in the presence of errors resembles
  2479.  
  2480. that of X.PC and SuperKermit.  Short bursts cause minimuml data loss.
  2481.  
  2482. Long bursts (such as pulse dialing noises) often require a timeout
  2483.  
  2484. error to restore the flow of data.
  2485.  
  2486.  
  2487.  
  2488. 15.  PACKET SWITCHED NETWORK CONSIDERATIONS
  2489.  
  2490.  
  2491. Flow control is necessary for printing messages and directories, and
  2492.  
  2493. for streaming file transfer protocols including Kermit Sliding
  2494.  
  2495. Windows and ZMODEM.  A non transparent flow control is incompatible
  2496.  
  2497. with XMODEM and YMODEM transfers.  XMODEM and YMODEM protocols
  2498.  
  2499. require complete transparency of all 256 8 bit codes to operate
  2500.  
  2501. properly.
  2502.  
  2503.  
  2504. The most desireable flow control (when X.25 or hardware CTS is
  2505.  
  2506. unavailable) does not "eat" any characters at all.  When the PAD's
  2507.  
  2508. buffer almost fills up, an XOFF should be emitted.  When the buffer
  2509.  
  2510. is no longer nearly full, send an XON.  Otherwise, the network should
  2511.  
  2512. neither generate nor eat XON or XOFF control characters.
  2513.  
  2514.  
  2515. On Telenet, this can be met by setting CCIT X3 5:1 and 12:0 at both
  2516.  
  2517. ends of the network.  For best throughput, parameter 64 (advance ACK)
  2518.  
  2519. should be set to something like 4.  Packets should be sent when the
  2520.  
  2521. packet is a full 128 bytes, or after a moderate delay (3:0,4:10,6:0).
  2522.  
  2523.  
  2524. For YMODEM, PAD buffering should guarantee that a minimum of 1040
  2525.  
  2526. characters can be sent in a burst without loss of data or generation
  2527.  
  2528. of flow control characters.  Failure to provide this buffering will
  2529.  
  2530. generate excessive retries with YMODEM.
  2531.  
  2532.  
  2533.                   Figure 4.  Flow Control Compatibility
  2534.  
  2535.  
  2536.          Connectivity            Interactive   XMODEM   KERMIT   ZMODEM
  2537.  
  2538.  
  2539. Direct Connection                YES           YES      YES      YES
  2540.  
  2541. Network, no flow control         NO            YES      (1)      (1)
  2542.  
  2543. Network, transparent f.c.        YES           YES      YES      YES
  2544.  
  2545. Network, semi-transparent f.c.   YES           NO       YES      YES
  2546.  
  2547. Network, 7 bit                   YES           NO       YES(2)   NO(3)
  2548.  
  2549.  
  2550. (1) Cannot operate in streaming mode.  Kermit is very slow because of
  2551.  
  2552. 96 byte max packet size.  ZMODEM can adjust burst length to maximum
  2553.  
  2554. for faster transfers.
  2555.  
  2556.  
  2557.  
  2558.  
  2559. Chapter 15              rev051486 Printed 5-16-86                       24
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568. Chapter 15              rev051486 Printed 5-16-86                       25
  2569.  
  2570.  
  2571.  
  2572.  
  2573. (2) Parity bits must be encoded, slowing binary transfers.
  2574.  
  2575.  
  2576. (3) Extension possible for encoding data to 7 bits.
  2577.  
  2578.  
  2579.  
  2580.  
  2581. 16.  PERFORMANCE COMPARISION TABLES
  2582.  
  2583.  
  2584.  
  2585. "Round Trip Delay Time" includes the time for the last byte in a
  2586.  
  2587. packet to propagate through the operating systems and network to the
  2588.  
  2589. receiver, plus the time for the receiver's response to that packet to
  2590.  
  2591. propogate back to the sender.
  2592.  
  2593.  
  2594. The figures shown below are calculated for round trip delay times of
  2595.  
  2596. 40 milliseconds and 5 seconds.  Shift registers in the two computers
  2597.  
  2598. and a pair of 212 modems generate a round trip delay time on the
  2599.  
  2600. order of 40 milliseconds.  Operation with busy timesharing computers
  2601.  
  2602. and networks can easily generate round trip delays of five seconds.
  2603.  
  2604. Because the round trip delays cause visible interruptions of data
  2605.  
  2606. transfer when using XMODEM protocol, the subjective effect of these
  2607.  
  2608. delays is greatly exaggerated, especially when the user is paying for
  2609.  
  2610. connect time.
  2611.  
  2612.  
  2613. A 102400 byte binary file with randomly distributed codes is sent at
  2614.  
  2615. 1200 bps 8 data bits, 1 stop bit.  The calculations assume no
  2616.  
  2617. transmission errors.  For each of the protocols, only the per file
  2618.  
  2619. functions are considered.  Processor and I/O overhead are not
  2620.  
  2621. included.  YM-k refers to YMODEM with 1024 byte packets.  YM-g refers
  2622.  
  2623. to the YMODEM "g" option.  ZMODEM uses 256 byte packets for this
  2624.  
  2625. example.  SuperKermit uses maximum packet size, 8 bit transparent
  2626.  
  2627. transmission, no run length compression.
  2628.  
  2629.  
  2630. For comparison, a straight "dump" of the file contents with no file
  2631.  
  2632. management or error checking takes 853 seconds.
  2633.  
  2634.  
  2635.                  Figure 5.  Protocol Overhead Information
  2636.  
  2637.  
  2638.       Protocol          XMODEM   YM-k    YM-g   ZMODEM   S-Kermit
  2639.  
  2640.  
  2641. Protocol Round Trips    803      103     5      5        5
  2642.  
  2643. Trip Time at 40ms       32s      4s      0      0        0
  2644.  
  2645. Trip Time at 5s         4015s    515s    25s    25s      25
  2646.  
  2647.  
  2648. Overhead Characters     4803     603     503    3600     38280
  2649.  
  2650.  
  2651. Transfer Time at 0s     893s     858s    857s   883s     1172s
  2652.  
  2653. Transfer Time at 40ms   925s     862s    857s   883s     1172s
  2654.  
  2655. Transfer Time at 5s     5761s    1373s   882s   918s     1197s
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662. Chapter 16              rev051486 Printed 5-16-86                       25
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671. Chapter 16              rev051486 Printed 5-16-86                       26
  2672.  
  2673.  
  2674.  
  2675.  
  2676.                  Figure 6.  Transmission Time Comparision
  2677.  
  2678.                         (5 Second Round Trip)
  2679.  
  2680.  
  2681. ************************************************** XMODEM
  2682.  
  2683. ************ YMODEM-K
  2684.  
  2685. ********** SuperKermit (Sliding Windows)
  2686.  
  2687. ******* YMODEM-G
  2688.  
  2689. ******* ZMODEM
  2690.  
  2691.  
  2692.                Figure 7.  Y/ZMODEM Header Information usage
  2693.  
  2694.  
  2695.  
  2696.   Program     Batch   Length   Date   Mode   S/N   YMODEM-g   ZMODEM
  2697.  
  2698.  Unix rb/sb   yes     yes      yes    yes    no    sb only    no
  2699.  
  2700.  Unix rz/sz   yes     yes      yes    yes    no    sz only    yes
  2701.  
  2702.  VMS rb/sb    yes     yes      no     no     no    no         no
  2703.  
  2704.  Pro-YAM      yes     yes      yes    no     yes   yes        yes
  2705.  
  2706.  CP/M YAM     yes     no       no     no     no    no         no
  2707.  
  2708.  KMD/IMP      yes     yes-     no     no     no    no         no
  2709.  
  2710.  MEX          no      no       no     no     no    no         no
  2711.  
  2712.  
  2713.  
  2714. 17.  MORE INFORMATION
  2715.  
  2716.  
  2717. More information may be obtained by calling Telegodzilla at
  2718.  
  2719. 503-621-3746.
  2720.  
  2721.  
  2722. UUCP sites can obtain the nroff/troff source to this file with
  2723.  
  2724.               uucp omen!/usr/caf/public/zmodem.mm /tmp
  2725.  
  2726. A continually updated list of available files is stored in
  2727.  
  2728. /usr/spool/uucppublic/FILES.
  2729.  
  2730.  
  2731. The following L.sys line calls site "omen" yia UUCP.  Telegodzilla
  2732.  
  2733. uses Pro-YAM in host operation.
  2734.  
  2735.  
  2736. In response to "Name Please:" uucico gives the Pro-YAM "link" command
  2737.  
  2738. as a user name.  The password (Giznoid) controls access to the Xenix
  2739.  
  2740. system connected to the IBM PC's other serial port.  Communications
  2741.  
  2742. between Pro-YAM and Xenix use 9600 bps; YAM converts this to the
  2743.  
  2744. caller's speed.
  2745.  
  2746.  
  2747. Finally, the calling uucico logs in as uucp.
  2748.  
  2749.  
  2750.  omen Any ACU 1200 1-503-621-3746 e:--e: link d: Giznoid n:--n: uucp
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762. Chapter 18              rev051486 Printed 5-16-86                       26
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771. Chapter 18              rev051486 Printed 5-16-86                       27
  2772.  
  2773.  
  2774.  
  2775.  
  2776. 18.  ZMODEM PROGRAMS
  2777.  
  2778.  
  2779. A demonstration version of Professional-YAM is available as
  2780.  
  2781. YAMDEMO.ARC on TeleGodzilla..  This file must be unpacked with the
  2782.  
  2783. "ARC" program, version 5 or later.  A copy of ARC is available as
  2784.  
  2785. "ARC.EXE" or "ARC510.COM" on TeleGodzilla.
  2786.  
  2787.  
  2788.  
  2789. This may be used to test ZMODEM and YMODEM implementations.  A
  2790.  
  2791. flash-up tree structured help file and processor are provided in
  2792.  
  2793. YAMHELP.LQR.
  2794.  
  2795.  
  2796.  
  2797.  
  2798. 19.  YMODEM PROGRAMS
  2799.  
  2800.  
  2801. Unix programs supporting the YMODEM protocol are available on
  2802.  
  2803. Telegodzilla in the "upgrade" subdirectory as RBSB.SHQ (a SQueezed
  2804.  
  2805. shell archive).  Most Unix like systems are supported, including V7,
  2806.  
  2807. Sys III, 4.2 BSD, SYS V, Idris, Coherent, and Regulus.
  2808.  
  2809.  
  2810. A version for VAX-VMS is available in VRBSB.SHQ, in the same
  2811.  
  2812. directory.
  2813.  
  2814.  
  2815. Irv Hoff has added YMODEM 1k packets and YMODEM batch transfers to
  2816.  
  2817. the KMD and IMP series programs, which replace the XMODEM and
  2818.  
  2819. MODEM7/MDM7xx series respectively.  Overlays are available for a wide
  2820.  
  2821. variety of CP/M systems.
  2822.  
  2823.  
  2824. Many other programs, including MEX and MEX-PC also support some of
  2825.  
  2826. the YMODEM extensions.
  2827.  
  2828.  
  2829. Questions about YMODEM, the Professional-YAM communications program,
  2830.  
  2831. and requests for evaluation copies may be directed to:
  2832.  
  2833.  
  2834.      Chuck Forsberg
  2835.  
  2836.      Omen Technology Inc
  2837.  
  2838.      17505-V Sauvie Island Road
  2839.  
  2840.      Portland Oregon 97231
  2841.  
  2842.      Voice: 503-621-3406
  2843.  
  2844.      Modem (Telegodzilla): 503-621-3746
  2845.  
  2846.      Usenet: ...!tektronix!reed!omen!caf
  2847.  
  2848.      Compuserve: 70715,131
  2849.  
  2850.      Source: TCE022
  2851.  
  2852.  
  2853.                                   Yours very truly,
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863. Chapter 19              rev051486 Printed 5-16-86                       27
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.                               CONTENTS
  2877.  
  2878.  
  2879.  
  2880.  1.  INTENDED AUDIENCE................................................   2
  2881.  
  2882.  
  2883.  2.  ACKNOWLEDGMENTS..................................................   2
  2884.  
  2885.  
  2886.  3.  RELATED DOCUMENTS................................................   2
  2887.  
  2888.  
  2889.  4.  ROSETTA STONE....................................................   2
  2890.  
  2891.  
  2892.  5.  WHY DEVELOP ZMODEM?..............................................   3
  2893.  
  2894.  
  2895.  6.  ZMODEM Protocol Design Criteria..................................   5
  2896.  
  2897.      6.1    Ease of Use...............................................   5
  2898.  
  2899.      6.2    Throughput................................................   5
  2900.  
  2901.      6.3    Integrity and Robustness..................................   6
  2902.  
  2903.      6.4    Ease of Implementation....................................   6
  2904.  
  2905.  
  2906.  7.  ZMODEM BASICS....................................................   6
  2907.  
  2908.      7.1    Packetization.............................................   7
  2909.  
  2910.      7.2    Link Escape Encoding......................................   7
  2911.  
  2912.      7.3    Header Packet Information.................................   8
  2913.  
  2914.      7.4    Binary Header Packet......................................   9
  2915.  
  2916.      7.5    HEX Header Packet.........................................   9
  2917.  
  2918.      7.6    Binary Data Packets.......................................  10
  2919.  
  2920.      7.7    ASCII Encoded Data Packet.................................  10
  2921.  
  2922.  
  2923.  8.  PROTOCOL TRANSACTION OVERVIEW....................................  10
  2924.  
  2925.      8.1    Session Cancel Packet.....................................  13
  2926.  
  2927.  
  2928.  9.  ZMODEM STREAMING TECHNIQUES......................................  14
  2929.  
  2930.      9.1    Full Streaming with Sampling..............................  14
  2931.  
  2932.      9.2    Full Streaming with Interrupt.............................  14
  2933.  
  2934.      9.3    Full Streaming with a Sliding Window......................  15
  2935.  
  2936.      9.4    No Streaming..............................................  15
  2937.  
  2938.  
  2939. 10.  ATTENTION SEQUENCE...............................................  15
  2940.  
  2941.  
  2942. 11.  PACKET/FRAME TYPES...............................................  15
  2943.  
  2944.      11.1   ZRQINIT...................................................  16
  2945.  
  2946.      11.2   ZRINIT....................................................  16
  2947.  
  2948.      11.3   ZSINIT....................................................  16
  2949.  
  2950.      11.4   ZACK......................................................  16
  2951.  
  2952.      11.5   ZFILE.....................................................  16
  2953.  
  2954.      11.6   ZSKIP.....................................................  18
  2955.  
  2956.      11.7   ZNAK......................................................  18
  2957.  
  2958.      11.8   ZABORT....................................................  18
  2959.  
  2960.      11.9   ZFIN......................................................  18
  2961.  
  2962.      11.10  ZRPOS.....................................................  18
  2963.  
  2964.      11.11  ZDATA.....................................................  18
  2965.  
  2966.  
  2967.  
  2968.  
  2969.                                   - i -
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.      11.12  ZEOF......................................................  18
  2983.  
  2984.      11.13  ZFERR.....................................................  18
  2985.  
  2986.      11.14  ZCRC......................................................  18
  2987.  
  2988.      11.15  ZCHALLENGE................................................  19
  2989.  
  2990.      11.16  ZCOMPL....................................................  19
  2991.  
  2992.      11.17  ZCAN......................................................  19
  2993.  
  2994.      11.18  ZFREECNT..................................................  19
  2995.  
  2996.      11.19  ZCOMMAND..................................................  19
  2997.  
  2998.  
  2999. 12.  TRANSACTION EXAMPLE..............................................  20
  3000.  
  3001.      12.1   A simple file transfer....................................  20
  3002.  
  3003.      12.2   Challenge and Command Download............................  20
  3004.  
  3005.  
  3006. 13.  ZFILE FRAME FILE INFORMATION.....................................  21
  3007.  
  3008.  
  3009. 14.  PERFORMANCE RESULTS..............................................  23
  3010.  
  3011.      14.1   Throughput................................................  23
  3012.  
  3013.      14.2   Error Recovery............................................  23
  3014.  
  3015.  
  3016. 15.  PACKET SWITCHED NETWORK CONSIDERATIONS...........................  24
  3017.  
  3018.  
  3019. 16.  PERFORMANCE COMPARISION TABLES...................................  25
  3020.  
  3021.  
  3022. 17.  MORE INFORMATION.................................................  26
  3023.  
  3024.  
  3025. 18.  ZMODEM PROGRAMS..................................................  27
  3026.  
  3027.  
  3028. 19.  YMODEM PROGRAMS..................................................  27
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.                                   - ii -
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.                              LIST OF FIGURES
  3073.  
  3074.  
  3075.  
  3076. Figure 1.  Order of Bytes in Header Packet............................   8
  3077.  
  3078.  
  3079. Figure 2.  Binary Header Packet.......................................   9
  3080.  
  3081.  
  3082. Figure 3.  HEX Header Packet..........................................  10
  3083.  
  3084.  
  3085. Figure 4.  Flow Control Compatibility.................................  24
  3086.  
  3087.  
  3088. Figure 5.  Protocol Overhead Information..............................  25
  3089.  
  3090.  
  3091. Figure 6.  Transmission Time Comparision..............................  26
  3092.  
  3093.  
  3094. Figure 7.  Y/ZMODEM Header Information usage..........................  26
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.                                  - iii -
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.      The ZMODEM Asynchronous Inter Application File Transfer Protocol
  3143.  
  3144.  
  3145.                               Chuck Forsberg
  3146.  
  3147.  
  3148.                            Omen Technology Inc
  3149.  
  3150.  
  3151.  
  3152.                                  ABSTRACT
  3153.  
  3154.  
  3155.  
  3156.  
  3157. The ZMODEM file transfer protocol greatly simplifies file transfers
  3158.  
  3159. compared to XMODEM.  In addition to supporting a transparent user
  3160.  
  3161. interface, ZMODEM provides Personal Computer and other users an efficient,
  3162.  
  3163. accurate, robust file transfer method.
  3164.  
  3165.  
  3166. ZMODEM provides especially efficient file transfers with timesharing
  3167.  
  3168. systems, satellite relays, and wide area packet switched networks.  A
  3169.  
  3170. choice of buffering and windowing modes allow ZMODEM to operate
  3171.  
  3172. efficiently on systems that cannot support some other s
  3173.